<?php
class TwitterTextComponent extends Object {

    var $autolinker = null;
    var $extractor = null;

    function autolink($text) {
        if (!is_a($this->autolinker, 'Twitter_Autolink')) {
            App::import('Vendor', 'Twitter_Autolink', array('file'=>'Twitter/Autolink.php'));
            $this->autolinker = new Twitter_Autolink;
        }
//$html = $autolinker->autolink('Tweet mentioning @mikenz and refuring to his list @mikeNZ/sports and website http://mikenz.geek.nz');

        return $this->autolinker->autolink($text);
    }

    function extract($text) {
        if (!is_a($this->extractor, 'Twitter_Extractor')) {
            App::import('Vendor', 'Twitter_Extractor', array('file'=>'Twitter/Extractor.php'));
            $this->extractor = new Twitter_Extractor;
        }
//$data = $extractor->extractAll('Tweet mentioning @mikenz and referring to his list @mikeNZ/sports and website http://mikenz.geek.nz');

        return $this->extractor->extractAll($text);
    }
}
?>
